# BUILD FILE SYNTAX: SKYLARK
load("//:selenium-version.bzl", "SE_VERSION")

java_library(
  name = 'api',
  srcs = [
    'Augmentable.java',
    'Command.java',
    'CommandExecutor.java',
    'ErrorCodes.java',
    'Response.java',
    'ScreenshotException.java',
    'SessionId.java',
  ],
  deps = [
    '//java/client/src/org/openqa/selenium:core',
    '//third_party/java/guava:guava',
  ],
  visibility = [
    '//java/client/src/org/openqa/selenium/json:json',
  ]
)

java_library(
  name = 'capabilities',
  srcs = [
    'BrowserType.java',
    'CapabilityType.java',
    'DesiredCapabilities.java',
  ],
  deps = [
    '//java/client/src/org/openqa/selenium:selenium',
    '//third_party/java/guava:guava',
  ],
  visibility = [
    '//java/client/src/org/openqa/selenium/remote/session:session',
  ]
)

java_library(
  name = 'http-session-id',
  srcs = [ 'HttpSessionId.java' ],
)

java_library(name = 'remote',
  maven_coords = 'org.seleniumhq.selenium:selenium-remote-driver:' + SE_VERSION,
  maven_pom_template = '//java/client/src/org/openqa/selenium:template-pom',
  srcs = [
    'Augmenter.java',
    'AugmenterProvider.java',
    'AddFindsByCss.java',
    'AddFindsChildByCss.java',
    'AddRemoteTouchScreen.java',
    'AddRotatable.java',
    'BaseAugmenter.java',
    'InterfaceImplementation.java',
    'JdkAugmenter.java',
    'html5/AddApplicationCache.java',
    'html5/AddLocationContext.java',
    'html5/AddWebStorage.java',
    'mobile/AddNetworkConnection.java',
  ],
  exported_deps = [
    ':remote-lib',
    '//java/client/src/org/openqa/selenium:selenium',
  ],
  deps = [
    '//third_party/java/bytebuddy:byte-buddy',
    '//third_party/java/guava:guava',
  ],
  visibility = ['PUBLIC'],
)


java_library(name = 'remote-lib',
  srcs = [
    'CommandCodec.java',
    'CommandInfo.java',
    'Dialect.java',
    'DriverCommand.java',
    'ErrorHandler.java',
    'ExecuteMethod.java',
    'FileDetector.java',
    'Gecko013ProtocolResponse.java',
    'HandshakeResponse.java',
    'HttpCommandExecutor.java',
    'InitialHandshakeResponse.java',
    'JsonWireProtocolResponse.java',
    'LocalFileDetector.java',
    'NewSessionPayload.java',
    'ProtocolHandshake.java',
    'RemoteExecuteMethod.java',
    'RemoteKeyboard.java',
    'RemoteLogs.java',
    'RemoteMouse.java',
    'RemoteStatus.java',
    'RemoteTouchScreen.java',
    'RemoteWebDriver.java',
    'RemoteWebElement.java',
    'ResponseCodec.java',
    'UnreachableBrowserException.java',
    'UselessFileDetector.java',
    'W3CHandshakeResponse.java',
    'html5/RemoteApplicationCache.java',
    'html5/RemoteLocalStorage.java',
    'html5/RemoteLocationContext.java',
    'html5/RemoteSessionStorage.java',
    'html5/RemoteWebStorage.java',
    'http/HttpClient.java',
    'http/HttpMessage.java',
    'http/HttpMethod.java',
    'http/HttpRequest.java',
    'http/HttpResponse.java',
    'http/AbstractHttpCommandCodec.java',
    'http/AbstractHttpResponseCodec.java',
    'http/JsonHttpCommandCodec.java',
    'http/JsonHttpResponseCodec.java',
    'http/W3CHttpCommandCodec.java',
    'http/W3CHttpResponseCodec.java',
    'internal/ApacheHttpClient.java',
    'internal/HttpClientFactory.java',
    'internal/HttpUrlBuilder.java',
    'internal/OkHttpClient.java',
    'internal/JsonToWebElementConverter.java',
    'internal/WebElementToJsonConverter.java',
    'mobile/RemoteNetworkConnection.java',
  ] + glob([
    'service/*.java',
  ]),
  resources = [
    ':get-attribute',
    ':is-displayed',
  ],
  exported_deps = [
    ':api',
    ':capabilities',
    '//java/client/src/org/openqa/selenium/json:json',
    '//java/client/src/org/openqa/selenium/remote/session:session',
    '//third_party/java/httpcomponents:httpclient',
    '//third_party/java/okhttp3:okhttp',
  ],
  deps = [
    ':http-session-id',
    '//java/client/src/org/openqa/selenium:selenium',
    '//third_party/java/guava:guava',
  ],
)

export_file(
  name = 'get-attribute',
  src = '//javascript/webdriver/atoms:get-attribute',
  out = 'getAttribute.js',
)

export_file(
  name = 'is-displayed',
  src = '//javascript/atoms/fragments:is-displayed',
  out = 'isDisplayed.js',
)
